domUs shouldn't be allowed to set arbitrary memory attributes.
This could allow accessing system memory with uncached attributes,
leading to address aliasing, unsupported transactions, or worse.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
pteval2 |= (pteval & _PAGE_ED);
pteval2 |= _PAGE_PL_2; // force PL0->2 (PL3 is unaffected)
pteval2 = (pteval & ~_PAGE_PPN_MASK) | pteval2;
+ /*
+ * Don't let non-dom0 domains map uncached addresses. This can
+ * happen when domU tries to touch i/o port space. Also prevents
+ * possible address aliasing issues.
+ */
+ if (d != dom0)
+ pteval2 &= ~_PAGE_MA_MASK;
+
return pteval2;
}